home *** CD-ROM | disk | FTP | other *** search
/ Dr. Windows 3 / dr win3.zip / dr win3 / WINWORDS / WINE02BX.ZIP / README.DOS < prev    next >
Text File  |  1993-03-28  |  12KB  |  372 lines

  1. MS-DOS-specific featuers of Win-Emacs
  2. *************************************
  3.  
  4. This file is taken from Demacs version 1.2.0.
  5.  
  6.  
  7. Features
  8. ********
  9.  
  10.  
  11.  
  12. File Type: Text or Binary Translation
  13. =====================================
  14.  
  15.  
  16.  
  17. Translation Mode
  18. ----------------
  19.  
  20. On MS-DOS file systems, a line is ended with CR (0x0d)/LF (0x0a)
  21. characters and a file is ended with a `Ctrl-Z' character. But on the UNIX
  22. file system, a line is ended with only an LF character, and end of data means
  23. end of file.
  24.  
  25. Win-Emacs provides two translation modes:
  26.  
  27.    * Text mode translation
  28.    * Binary mode translation
  29.  
  30. With text mode translation, on reading, CR/LF codes are translated to LF
  31. and reading is terminated as soon as `Ctrl-Z' appears. On writing, CR is
  32. added to LR and `Ctrl-Z' is added to the end of file.
  33.  
  34. With binary mode translation, no code is translated.
  35.  
  36. Win-Emacs supports these two translation modes, and manages them on each
  37. buffer. You can find current the translation mode of the buffer from the file
  38. type mnemonic on the mode line.
  39.  
  40.      --**-Emacs: demacs.tex   (T:Texinfo)--42%---------------
  41.                                ^
  42.  
  43. File type mnemonic means
  44.  
  45. `T'
  46.      Text mode translation.
  47. `B'
  48.      Binary mode translation.
  49.  
  50. We call this translation mode which is managed on each buffer "file
  51. type".
  52.  
  53.  
  54.  
  55. Win-Emacs Buffer Management
  56. ---------------------------
  57.  
  58.  
  59.  
  60. File Type of Each Buffer
  61. ........................
  62.  
  63. The file type of each buffer is stored in buffer-local `file-type' variable. 
  64. To set the value of `file-type' use the `set-file-type' function.
  65.  
  66. The default value of `file-type' is the value of `default-file-type'
  67. variable. To set its value, use the `set-default-file-type' function.
  68.  
  69. ## Local Variable: file-type
  70.      `0'
  71.           Text mode translation.
  72.      `1'
  73.           Binary mode translation.
  74.  
  75. ## Command: set-file-type TYPE &optional BUFFER
  76.      This function sets buffer-local `file-type' variable of BUFFER to
  77.      TYPE. The argument BUFFER defaults to the current buffer. The value
  78.      of TYPE is one of following.
  79.      `0' or `'text' or `"text"'
  80.           Specify the buffer's file type as text mode.
  81.      `1' or `'binary' or `"binary"'
  82.           Specify the buffer's file type as binary mode.
  83.  
  84. ## Global Variable: default-file-type
  85.      The value of this global variable is the default value of
  86.      buffer-local `file-type' variable.
  87.  
  88. ## Command: set-default-file-type TYPE
  89.      This function sets the value of `default-file-type' variable to
  90.      TYPE. The value of TYPE is one of following.
  91.      `0' or `'text' or `"text"'
  92.           Specify the buffer's file type as text mode, by default.
  93.      `1' or `'binary' or `"binary"'
  94.           Specify the buffer's file type as binary mode, by default.
  95.  
  96.  
  97.  
  98. Buffer Creation
  99. ...............
  100.  
  101. When creating a new buffer, Win-Emacs sets the buffer's local variable
  102. `file-type' to the value of the `default-file-type' variable.
  103.  
  104.  
  105.  
  106. Reading Files into Win-Emacs Buffers
  107. ------------------------------------
  108.  
  109. Using the `define-file-name-file-type' function, you can define the file
  110. type associated with a file name.
  111.  
  112. For example, 
  113.  
  114.      (define-file-name-file-type "\\.mem$" 'binary)
  115.  
  116. specifies that the file type of files having extention `.mem' is binary.
  117.  
  118. By default, the files ending with `.elc', `.obj', `.exe', `.com',
  119. `.lib', `.sys' (except `config.sys'), `.chk', `.o', `.a' and `.out' are
  120. defined as binary file type.
  121.  
  122. ## Function: define-file-name-file-type FILENAME TYPE
  123.      This function defines the file type associated with a file name.
  124.      FILENAME is a regular expression or `nil'. `nil' matches any file
  125.      name. TYPE is the file type.
  126.  
  127. ## Function: find-file-type-from-file-name FILENAME
  128.      This function returns the file type which is associated with FILENAME
  129.      by the `define-file-name-file-type' function.  If no file type
  130.      is defined, this returns the value of `default-file-type'.
  131.  
  132.  
  133.  
  134. Inserting Files into Buffers
  135. ............................
  136.  
  137. When inserting a file into a buffer that is already visiting a file,
  138. Win-Emacs calls the `find-file-type-from-file-name' function with the
  139. file name of the target file as its argument, and sets the file type
  140. of the buffer to the return value from this function.
  141.  
  142.  
  143.  
  144. Visiting Files and Reading
  145. ..........................
  146.  
  147. When visiting a file and reading into a buffer, Win-Emacs calls the
  148. `find-file-type-from-file-name' function with the file name of the
  149. target file as its argument, and sets the file type of the buffer to
  150. the return value from this function.
  151.  
  152.  
  153.  
  154. Creating Files and Visiting
  155. ...........................
  156.  
  157. The `find-file-not-found-set-file-type' function is appended to
  158. the `find-file-not-found-hooks' variable. This means that
  159. `find-file-not-found-set-file-type' is called when the visiting
  160. file does not exist.
  161.  
  162. This function internally calls the `find-file-type-from-file-name'
  163. function with the target name as its argument and sets the file type
  164. of the buffer to the return value from this function.
  165.  
  166.  
  167.  
  168. Writing Buffers into Files
  169. --------------------------
  170.  
  171. When writing a buffer into a file, Win-Emacs sets the translation mode to
  172. the file type of the buffer.
  173.  
  174.  
  175.  
  176.  
  177. 8086 Software Interrupt
  178. =======================
  179.  
  180. Function `int86' generates an 8086 software interrupt.  Use this carefully.
  181.  
  182. Use this function like this.
  183.  
  184.      int
  185.      GetDisk ()
  186.      {
  187.        union REGS regs;
  188.        regs.h.ah = 0x19;     /* 25 */
  189.        int86 (0x21 /* 33 */, ®s, ®s);
  190.        return regs.h.al;
  191.      }
  192.  
  193. This C function to get the current disk number may be written in Win-Emacs
  194. as follows:
  195.  
  196.      (defun get-disk ()
  197.        (let ((regs (make-register)))
  198.          (set-register-value regs 'ah 25)    ; 0x19
  199.          (int86 33 regs)                     ; 0x21
  200.          (register-value regs 'al)))
  201.  
  202. ## Function: make-register
  203.      Generate an instance of register type.   This is a set of register values
  204.      and is passed to the `int86' function to specify the registers upon
  205.      invocation of the interrupt.
  206.  
  207. ## Function: register-value REGISTER NAME
  208.      Get the value of REGISTER's NAME. NAME is one of the following.
  209.  
  210.      `'ax'
  211.           `ax' register
  212.      `'bx'
  213.           `bx' register
  214.      `'cx'
  215.           `cx' register
  216.      `'dx'
  217.           `dx' register
  218.      `'si'
  219.           `si' register
  220.      `'di'
  221.           `di' register
  222.      `'cflag'
  223.           carry flag
  224.      `'flags'
  225.           flag register
  226.  
  227.      or
  228.  
  229.      `'al'
  230.           lower byte of `ax' register
  231.      `'ah'
  232.           upper byte of `ax' register
  233.      `'bl'
  234.           lower byte of `bx' register
  235.      `'bh'
  236.           upper byte of `bx' register
  237.      `'cl'
  238.           lower byte of `cx' register
  239.      `'ch'
  240.           upper byte of `cx' register
  241.      `'dl'
  242.           lower byte of `dx' register
  243.      `'dh'
  244.           upper byte of `dx' register
  245.  
  246. ## Function: set-register-value REGISTER NAME VALUE
  247.      Set REGISTER's NAME to VALUE. VALUE is an unsigned integer.
  248.  
  249. ## Function: int86 INTNO REGISTER
  250.      Generate 8086 software interrupt of number INTNO with REGISTER (an
  251.      instance of register type) specifying the registers upon invocation
  252.      of the interrupt.  An instance of register type is returned, specifying
  253.      the register values upon return from the interrupt.
  254.  
  255.  
  256. Other Win-Emacs Features
  257. ========================
  258.  
  259.   1. Filename Completion
  260.  
  261.      Win-Emacs provides a special filename completion feature. Filenames may
  262.      include a drive name at the front. For example, we assume the current
  263.      directory is `c:/tools/emacs' and there is a file `d:/config.sys';
  264.      then `C-x C-f' invokes `find-file' function and the function prompts
  265.  
  266.           Find file: c:/tools/emacs/
  267.  
  268.      At this point typing `d:/confi' and pressing TAB causes:
  269.  
  270.           a:/tools/emacs/d:confi^I  -> d:/config.sys [sole complete]
  271.  
  272.   2. Enhanced Dired
  273.  
  274.      Dired works without requiring an `ls.exe' program.
  275.  
  276.  
  277. Restrictions
  278. ************
  279.  
  280.    * `Ctrl-G' can't generate an interrupt signal. So you can't quit a
  281.      li